package cn.edu.xmu.oomall.payment.model.bo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class Order {
    /**
     * 订单状态
     */
    public enum State {
        OBLIGATION(100,"待支付"),
        CREATED(101,"新订单"),
        WAITFORBALANCE(102, "待支付尾款"),
        DROPSHIPPING(200,"待发货"),
        PAID(201,"付款完成"),
        WAITGROUP(202,"待成团"),
        DISPATCHED(300, "已发货"),
        FINISHED(400, "已完成"),
        CANCELED(500, "已取消"),
        TOBIRETURNED(501, "待退款"),
        REFUNED(502, "已退款");

        private static final Map<Integer, State> stateMap;

        static {
            stateMap = new HashMap();
            for (State enum1 : values()) {
                stateMap.put(enum1.code, enum1);
            }
        }

        private Integer code;
        private String description;

        State(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return this.code;
        }

        public String getDescription() {
            return this.description;
        }

        public State getDescriptionByCode(Integer code){
            return stateMap.get(code);
        }
    }

    private Long id;
    private Long customerId;
    private Long shopId;
    private String orderSn;
    private Long pid;
    private String consignee;
    private Long regionId;
    private String address;
    private String mobile;
    private String message;
    private Long advancesaleId;
    private Long grouponId;
    private Long expressFee;
    private Long discountPrice;
    private Long originPrice;
    private Long point;
    private LocalDateTime confirmTime;
    private String shipmentSn;
    private Integer state;
    private Byte beDeleted;
    private Long creatorId;
    private String creatorName;
    private Long modifierId;
    private String modifierName;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;

}
